﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Keepo.Models.Services
{
    public class DesignMaskExport
    {
        public DesignMaskExport() { }

        public DesignMaskExport(DesignMask designMask)
        {
            this.DesignMaskId = designMask.DesignMaskId;
            this.Title = designMask.Title;
            
            this.MaskData = designMask.MaskData;
            this.Color = designMask.Color;
            this.Corner = designMask.Corner;
            this.Weight = designMask.Weight;
            this.AlbumId = designMask.AlbumId == null ? -1 : designMask.AlbumId.Value;
            this.Effect = designMask.Effect ?? DesignMaskEffect.None;
            this.Blur = designMask.Blur;
        }

        public DesignMask toEntity()
        {
            DesignMask designMask = new DesignMask();
            
            designMask.DesignMaskId = this.DesignMaskId;
            designMask.Title = this.Title;
            
            designMask.MaskData = this.MaskData;
            designMask.Color = this.Color;
            designMask.Corner = this.Corner;
            designMask.Weight = this.Weight;

            if (this.AlbumId != -1)
            {
                designMask.AlbumId = this.AlbumId;
            }
            else
            {
                designMask.AlbumId = null;
            }

            designMask.Effect = this.Effect;
            designMask.Blur = this.Blur;

            return designMask;
        }

        public int DesignMaskId { get; set; }
        public int AlbumId { get; set; }
        public string Title { get; set; }
        public string MaskData { get; set; }
        public int Color { get; set; }
        public float Weight { get; set; }
        public string Corner { get; set; }        // Miter / Round
        
        public string Effect { get; set; }        // None / Stroke / Blur
        public float Blur { get; set; }
    }
}